clear			all
set 			more off
cd 				"~/Dropbox/Indonesia Migration/" // Specify your root directory here
/*******************************************************************************
					EDUCATION HETEROGENEITY
*******************************************************************************/	
use				"Data/Merged", clear
bys				year: egen mean_av_high_educ = mean(av_high_educ)
bys				year: gen high_educ_regency = av_high_educ >= mean_av_high_educ
foreach 		var in emp native_emp mig_emp_o mig_emp_n ///
				wage native_wage mig_wage_o mig_wage_n ///
				SE native_SE mig_SE_o mig_SE_n ///
				unpaid native_unpaid mig_unpaid_o mig_unpaid_n {
replace			prop_`var' = prop_`var' * 100
}
label 			var per_immig_cst_5Y "Population share of new migrants in year t"
label 			var per_immig_cst_5Y_lag "Population share of new migrants in year t-5"


/*******************************************************************************
					Employment	
********************************************************************************/
quietly ivreg2	prop_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p1

quietly ivreg2	prop_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p2
				
quietly ivreg2	prop_native_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p3

quietly ivreg2	prop_native_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p4
				
quietly ivreg2	prop_mig_emp_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p5
				
quietly ivreg2	prop_mig_emp_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p6
				
quietly ivreg2	prop_mig_emp_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p7
				
quietly ivreg2	prop_mig_emp_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p8
				
coefplot (p1, keep(per_immig_cst_5Y) mcolor(black) offset(-2.6) ciopts(recast(rcap) lcolor(black))) ///
(p1, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-3.4) ciopts(recast(rcap) lcolor(black))) ///
(p2, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(-1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p2, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p3, keep(per_immig_cst_5Y) mcolor(black) offset(-0.6) ciopts(recast(rcap) lcolor(black))) ///
(p3, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-1.4) ciopts(recast(rcap) lcolor(black))) ///
(p4, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p4, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p5, keep(per_immig_cst_5Y) mcolor(black) offset(1.4) ciopts(recast(rcap) lcolor(black))) ///
(p5, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(0.6) ciopts(recast(rcap) lcolor(black))) ///
(p6, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p6, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p7, keep(per_immig_cst_5Y) mcolor(black) offset(3.4) ciopts(recast(rcap) lcolor(black))) ///
(p7, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(2.6) ciopts(recast(rcap) lcolor(black))) ///
(p8, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(4.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p8, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(3.6) ciopts(recast(rcap) lcolor(dkgreen))), ///
vertical yline(0, lpattern (dash) lcolor(red)) scheme(s1color) /// 
xlabel(-1.5 `" "All People" "High Education" "' -0.5 `" "All People" "Low Education" "' /// 
0.5 `" "Natives" "High Education" "' 1.5 `" "Natives" "Low Education" "' /// 
2.5 `" "Old Migrants" "High Education" "' 3.5 `" "Old Migrants" "Low Education" "' /// 
4.5 `" "New Migrants" "High Education" "' 5.5 `" "New Migrants" "Low Education" "', ///
noticks labsize(small)) title("{bf:Panel A:} Impact of internal migration on employment", size(small)) /// 
xsize(16) ysize(8) xline(0 2 4, lcolor(gs12)) /// 
legend(order(2 "New migrants in year {it:t}" 4 "New migrants in year {it:t-5}") size(small)) /// 
graphregion(margin(2 4 2 2)) xscale(r(-2 6) noextend titlegap(2)) yscale(titlegap(2))
	
graph export "Coefplots/T8_emp_edu_mt10.jpg", as(jpg) name("Graph") quality(100) replace
	
/*******************************************************************************
					Wage employment
********************************************************************************/				
quietly ivreg2	prop_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p1

quietly ivreg2	prop_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p2
				
quietly ivreg2	prop_native_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p3

quietly ivreg2	prop_native_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p4		
				
quietly ivreg2	prop_mig_wage_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p5
				
quietly ivreg2	prop_mig_wage_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p6
				
quietly ivreg2	prop_mig_wage_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p7
				
quietly ivreg2	prop_mig_wage_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p8			
				
coefplot (p1, keep(per_immig_cst_5Y) mcolor(black) offset(-2.6) ciopts(recast(rcap) lcolor(black))) ///
(p1, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-3.4) ciopts(recast(rcap) lcolor(black))) ///
(p2, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(-1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p2, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p3, keep(per_immig_cst_5Y) mcolor(black) offset(-0.6) ciopts(recast(rcap) lcolor(black))) ///
(p3, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-1.4) ciopts(recast(rcap) lcolor(black))) ///
(p4, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p4, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p5, keep(per_immig_cst_5Y) mcolor(black) offset(1.4) ciopts(recast(rcap) lcolor(black))) ///
(p5, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(0.6) ciopts(recast(rcap) lcolor(black))) ///
(p6, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p6, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p7, keep(per_immig_cst_5Y) mcolor(black) offset(3.4) ciopts(recast(rcap) lcolor(black))) ///
(p7, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(2.6) ciopts(recast(rcap) lcolor(black))) ///
(p8, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(4.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p8, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(3.6) ciopts(recast(rcap) lcolor(dkgreen))), ///
vertical yline(0, lpattern (dash) lcolor(red)) scheme(s1color) /// 
xlabel(-1.5 `" "All People" "High Education" "' -0.5 `" "All People" "Low Education" "' /// 
0.5 `" "Natives" "High Education" "' 1.5 `" "Natives" "Low Education" "' /// 
2.5 `" "Old Migrants" "High Education" "' 3.5 `" "Old Migrants" "Low Education" "' /// 
4.5 `" "New Migrants" "High Education" "' 5.5 `" "New Migrants" "Low Education" "', ///
noticks labsize(small)) title("{bf:Panel B:} Impact of internal migration on wage employment", size(small)) /// 
xsize(16) ysize(8) xline(0 2 4, lcolor(gs12)) /// 
legend(order(2 "New migrants in year {it:t}" 4 "New migrants in year {it:t-5}") size(small)) /// 
graphregion(margin(2 4 2 2)) xscale(r(-2 6) noextend titlegap(2)) yscale(titlegap(2))
	
graph export "Coefplots/T8_wage_edu_mt10.jpg", as(jpg) name("Graph") quality(100) replace				
				
				
							
/*******************************************************************************
					Self employment
********************************************************************************/				
quietly ivreg2	prop_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p1

quietly ivreg2	prop_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p2
								
quietly ivreg2	prop_native_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p3

quietly ivreg2	prop_native_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p4
								
quietly ivreg2	prop_mig_SE_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p5
				
quietly ivreg2	prop_mig_SE_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p6
				
quietly ivreg2	prop_mig_SE_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p7
				
quietly ivreg2	prop_mig_SE_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p8					
				
coefplot (p1, keep(per_immig_cst_5Y) mcolor(black) offset(-2.6) ciopts(recast(rcap) lcolor(black))) ///
(p1, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-3.4) ciopts(recast(rcap) lcolor(black))) ///
(p2, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(-1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p2, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p3, keep(per_immig_cst_5Y) mcolor(black) offset(-0.6) ciopts(recast(rcap) lcolor(black))) ///
(p3, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-1.4) ciopts(recast(rcap) lcolor(black))) ///
(p4, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p4, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p5, keep(per_immig_cst_5Y) mcolor(black) offset(1.4) ciopts(recast(rcap) lcolor(black))) ///
(p5, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(0.6) ciopts(recast(rcap) lcolor(black))) ///
(p6, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p6, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p7, keep(per_immig_cst_5Y) mcolor(black) offset(3.4) ciopts(recast(rcap) lcolor(black))) ///
(p7, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(2.6) ciopts(recast(rcap) lcolor(black))) ///
(p8, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(4.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p8, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(3.6) ciopts(recast(rcap) lcolor(dkgreen))), ///
vertical yline(0, lpattern (dash) lcolor(red)) scheme(s1color) /// 
xlabel(-1.5 `" "All People" "High Education" "' -0.5 `" "All People" "Low Education" "' /// 
0.5 `" "Natives" "High Education" "' 1.5 `" "Natives" "Low Education" "' /// 
2.5 `" "Old Migrants" "High Education" "' 3.5 `" "Old Migrants" "Low Education" "' /// 
4.5 `" "New Migrants" "High Education" "' 5.5 `" "New Migrants" "Low Education" "', ///
noticks labsize(small)) title("{bf:Panel C:} Impact of internal migration on self employment", size(small)) /// 
xsize(16) ysize(8) xline(0 2 4, lcolor(gs12)) /// 
legend(order(2 "New migrants in year {it:t}" 4 "New migrants in year {it:t-5}") size(small)) /// 
graphregion(margin(2 4 2 2)) xscale(r(-2 6) noextend titlegap(2)) yscale(titlegap(2))
	
graph export "Coefplots/T8_self_edu_mt10.jpg", as(jpg) name("Graph") quality(100) replace					
		
/*******************************************************************************
					Unpaid employment
********************************************************************************/				
quietly ivreg2	prop_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p1

quietly ivreg2	prop_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p2				
				
quietly ivreg2	prop_native_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p3

quietly ivreg2	prop_native_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p4				
				
quietly ivreg2	prop_mig_unpaid_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p5
				
quietly ivreg2	prop_mig_unpaid_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p6
				
quietly ivreg2	prop_mig_unpaid_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
eststo p7
				
quietly ivreg2	prop_mig_unpaid_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
eststo p8

coefplot (p1, keep(per_immig_cst_5Y) mcolor(black) offset(-2.6) ciopts(recast(rcap) lcolor(black))) ///
(p1, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-3.4) ciopts(recast(rcap) lcolor(black))) ///
(p2, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(-1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p2, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p3, keep(per_immig_cst_5Y) mcolor(black) offset(-0.6) ciopts(recast(rcap) lcolor(black))) ///
(p3, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(-1.4) ciopts(recast(rcap) lcolor(black))) ///
(p4, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p4, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(-0.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p5, keep(per_immig_cst_5Y) mcolor(black) offset(1.4) ciopts(recast(rcap) lcolor(black))) ///
(p5, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(0.6) ciopts(recast(rcap) lcolor(black))) ///
(p6, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(2.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p6, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(1.6) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p7, keep(per_immig_cst_5Y) mcolor(black) offset(3.4) ciopts(recast(rcap) lcolor(black))) ///
(p7, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(black) offset(2.6) ciopts(recast(rcap) lcolor(black))) ///
(p8, keep(per_immig_cst_5Y) mcolor(dkgreen) offset(4.4) ciopts(recast(rcap) lcolor(dkgreen))) ///
(p8, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(dkgreen) offset(3.6) ciopts(recast(rcap) lcolor(dkgreen))), ///
vertical yline(0, lpattern (dash) lcolor(red)) scheme(s1color) /// 
xlabel(-1.5 `" "All People" "High Education" "' -0.5 `" "All People" "Low Education" "' /// 
0.5 `" "Natives" "High Education" "' 1.5 `" "Natives" "Low Education" "' /// 
2.5 `" "Old Migrants" "High Education" "' 3.5 `" "Old Migrants" "Low Education" "' /// 
4.5 `" "New Migrants" "High Education" "' 5.5 `" "New Migrants" "Low Education" "', ///
noticks labsize(small)) title("{bf:Panel D:} Impact of internal migration on unpaid work", size(small)) /// 
xsize(16) ysize(8) xline(0 2 4, lcolor(gs12)) /// 
legend(order(2 "New migrants in year {it:t}" 4 "New migrants in year {it:t-5}") size(small)) /// 
graphregion(margin(2 4 2 2)) xscale(r(-2 6) noextend titlegap(2)) yscale(titlegap(2))
	
graph export "Coefplots/T8_unpaid_edu_mt10.jpg", as(jpg) name("Graph") quality(100) replace	



















